import 'package:base_flutter/base_flutter.dart';
import 'package:download_app/viewmodel/home_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';

class HomePage extends BaseStatefulMvvmWidget {
  @override
  State<StatefulWidget> createState() => _HomeState();
}

class _HomeState extends BaseMvvmState<HomeViewModel, HomePage> {
  @override
  Widget? buildLoadingContentView() {
    return Center(
      child: ElevatedButton(
        onPressed: () {
          viewModel.getDownloadUrl();
        },
        child: CommonText('下载App', textColor: Colors.white),
      ),
    );
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('首页'),
      ),
      body: loadingContentWidget,
    );
  }

  @override
  HomeViewModel createViewModel() {
    return HomeViewModel(context);
  }

  @override
  void onRetryClick() {
    // TODO: implement onRetryClick
  }
}
